<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Add User</title>
<script type="text/javascript" src="/js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="/js/jquery.serializejson.min.js"></script>
</head>
<body>
<form id="form" th:object="${user}" th:method="POST" th:action="@{/updateUser}">
	<table>
			<tr><input type="hidden" th:field="*{id}"/></tr>
			<tr>
				<td><label for="nickname" class="control-label">昵称：</label></td>
				<td><input type="text" th:field="*{nickname}" ></td>
			</tr>
			<tr>
				<td><label for="username" class="control-label">用户名：</label></td>
				<td><input type="text" th:field="*{username}" ></td>
			</tr>
			<tr>
				<td><label for="phone" class="control-label">电话：</label></td>
				<td><input type="text" th:field="*{phone}" ></td>
			</tr>
			<tr>
				<td><label for="email" class="control-label">邮箱：</label></td>
				<td><input type="text" th:field="*{email}" ></td>
			</tr>
			<tr>
				<td><label for="password" class="control-label">密码：</label></td>
				<td><input type="password" th:field="*{password}" ></td>
			</tr>
			
			<tr>
				<td><label for="role">角色：</label></td>
				<td><select class="form-control" name="role" >
						<option th:each="role:${roles}" th:value="${role.id}"
							th:text="${role.name}" th:selected="${user.role.id==role.id}"></option>
				</select>
				</td>
			</tr>
			
			<tr>
			<td><label for="albums">专辑：</label></td>
			<td class="check-box"><input th:each="album,albumState:${albums}" 
				id="albums" name="albums" type="checkbox" th:value="${album.id}"
				th:text="${album.name}" th:checked="${user.albums.contains(album)?true:false}"/></td>
			</tr>
			
			
			<tr>
			<td><label for="combinations">组合：</label></td>
			<td class="check-box">
			<input th:each="combination:${combinations}" id="combinations" name="combinations" type="checkbox" th:value="${combination.id}"
				th:text="${combination.name}"></td>
			</tr>
			
			<tr>
			<td><label for="singers">歌手：</label></td>
			<td class="check-box"><input th:each="singer:${singers}"
				id="singers" name="singers" type="checkbox" th:value="${singer.id}"
				th:text="${singer.chineseName}" th:checked="${user.singers.contains(singer)?true:false}"/></td>
			</tr>
			
			<tr>
			<td><label for="ownedSonglists">拥有的歌单：</label></td>
			<td class="check-box"><input th:each="songlist:${songlists}" 
				id="ownedSonglists" name="ownedSonglists" type="checkbox" th:value="${songlist.id}"
				th:text="${songlist.name}" th:checked="${user.ownedSonglists.contains(songlist)?true:false}"/></td>
			</tr>
			
			<tr>
			<td><label for="likeSonglists">拥有的歌单：</label></td>
			<td class="check-box"><input th:each="songlist:${songlists}" 
				id="ownedSonglists" name="ownedSonglists" type="checkbox" th:value="${songlist.id}"
				th:text="${songlist.name}" th:checked="${user.likeSonglists.contains(songlist)?true:false}"/></td>
			</tr>
			
		    <tr>
			<td><input type="submit" value="提交"></td>
		    </tr>
	</table>
	</form>
</body>
</html>